<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert-dev.min.js"></script>
    <link href="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.css" rel="stylesheet">
</head>
<script>
    // First, checks if it isn't implemented yet.
    if (!String.prototype.format) {
        String.prototype.format = function () {
            var args = arguments;
            return this.replace(/{(\d+)}/g, function (match, number) {
                return typeof args[number] != 'undefined'
                        ? args[number]
                        : match
                        ;
            });
        };
    }
    function DanaPutCursor(a, b, c) {
    }

    function JsMod(params) {
        url = "/detail";
        $.ajax({
            //提交数据的类型 POST GET
            type: "POST",
            //提交的网址
            url: url,
            //提交的数据
            data: {"params": params},
            //返回数据的格式
            datatype: "json",
            success: function (data) {
                result = JSON.parse(data);
                if (!result.isok) {
                    swal({
                        title: "平时成绩 <small>~~</small>",
                        text: "该科目没有平时成绩",
                        html: true
                    });
                }
                else {
                    table = '<table class="table"><tbody>\
                    <tr><th scope="row">平时成绩</th><td>{0}</td></tr>\
                    <tr><th scope="row">平时占比</th><td>{1}</td></tr>\
                    <tr><th scope="row">期中成绩</th><td>{2}</td></tr>\
                    <tr><th scope="row">期中占比</th><td>{3}</td></tr>\
                    <tr><th scope="row">期末成绩</th><td>{4}</td></tr>\
                    <tr><th scope="row">期末占比</th><td>{5}</td></tr>\
                    <tr><th scope="row">总成绩成绩</th><td>{6}</td></tr>\
                    </tbody></table>'.format(result.normal, result.bili1, result.medium, result.bili2, result.finale, result.bili3, result.total);
                    swal({
                        title: "平时成绩 <small>~~</small>",
                        text: table,
                        html: true
                    });
                    // alert(s)
                }
            },
            //调用出错执行的函数
            error: function () {
                swal({
                    title: "平时成绩 <small>~~</small>",
                    text: "服务器整个人都不好了~~",
                    html: true
                });
            }
        });
    }

</script>

<table class="table table-condensed">
    <thead>
    <tr>
        <th>id</th>
        <th>名称</th>
        <th>类别</th>
        <th>类型</th>
        <th>学时</th>
        <th>学分</th>
        <th>分数</th>
        {#        <th>考试情况</th>#}
    </tr>
    </thead>
    <tbody>
    {% for row in scoretable[:-2] %}
        <tr>
            <th scope="row">{{ row[0] }}</th>
            <td>{{ row[5] }}</td>
            <td>{{ row[8] }}</td>
            <td>{{ row[9] }}</td>
            <td>{{ row[10] }}</td>
            <td>{{ row[11] }}</td>
            <td><a onclick="{{ row[6][1] }}" class="btn btn-success btn-sm">{{ row[6][0] }}</a></td>
        </tr>
    {% endfor %}
    </tbody>
</table>
<h4 class="text-info">{{ scoretable[-2] }}<br>{{ scoretable[-1] }}</h4>

